package com.example.myapplication.model;

/**
 * RPC响应数据模型
 * 用于处理设备控制命令的响应
 */
public class RpcResponse {
    private String status;
    private String message;
    private Object result;

    public RpcResponse() {
    }

    public RpcResponse(String status, String message, Object result) {
        this.status = status;
        this.message = message;
        this.result = result;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getResult() {
        return result;
    }

    public void setResult(Object result) {
        this.result = result;
    }

    /**
     * 检查响应是否成功
     * @return 如果响应成功返回true
     */
    public boolean isSuccess() {
        return "success".equalsIgnoreCase(status) || 
               "ok".equalsIgnoreCase(status) ||
               result != null;
    }

    @Override
    public String toString() {
        return "RpcResponse{" +
                "status='" + status + '\'' +
                ", message='" + message + '\'' +
                ", result=" + result +
                '}';
    }
}
